﻿using System;

namespace HslCommunication
{
	// Token: 0x02000010 RID: 16
	internal class HslSecurity
	{
		/// <summary>
		/// 加密方法，只对当前的程序集开放
		/// </summary>
		/// <param name="enBytes">等待加密的数据</param>
		/// <returns>加密后的字节数据</returns>
		// Token: 0x06000093 RID: 147 RVA: 0x00004510 File Offset: 0x00002710
		internal static byte[] ByteEncrypt(byte[] enBytes)
		{
			bool flag = enBytes == null;
			byte[] result;
			if (flag)
			{
				result = null;
			}
			else
			{
				byte[] array = new byte[enBytes.Length];
				for (int i = 0; i < enBytes.Length; i++)
				{
					array[i] = (enBytes[i] ^ 181);
				}
				result = array;
			}
			return result;
		}

		// Token: 0x06000094 RID: 148 RVA: 0x0000455C File Offset: 0x0000275C
		internal static void ByteEncrypt(byte[] enBytes, int offset, int count)
		{
			for (int i = offset; i < offset + count; i++)
			{
				bool flag = i < enBytes.Length;
				if (!flag)
				{
					break;
				}
				enBytes[i] ^= 181;
			}
		}

		/// <summary>
		/// 解密方法，只对当前的程序集开放
		/// </summary>
		/// <param name="deBytes">等待解密的数据</param>
		/// <returns>解密后的字节数据</returns>
		// Token: 0x06000095 RID: 149 RVA: 0x00004599 File Offset: 0x00002799
		internal static byte[] ByteDecrypt(byte[] deBytes)
		{
			return HslSecurity.ByteEncrypt(deBytes);
		}
	}
}
